Technical Note TE18
TextEdit EOL Ambiguity

CONTENTS

TESetSelect may be used to position the insertion point at the end of a line. There is an ambiguity, though; should the insertion point appear at the end of the preceding line or the start of the following one? It is possible to determine what will happen, as you are about to see.

[Mon 01 1988]






Introduction

There is an internal flag used by TextEdit to determine where the insertion point at the end of a line appears. This flag is part of the clikStuff field in the TERec. It is there mainly for the use of TEClick, but it is also used by TESetSelect (although it defaults to the right side of the previous line).

The following code can be used to force the insertion point to appear at the left of the following line when it is positioned at the end of a line.

In MPW Pascal:

    TEDeactivate(tH);
    tH^^.clikStuff := 255;            {position caret on left}
    TESetSelect(eolcharpos, eolcharpos, tH);    {ambiguous point}

In MPW C:

    TEDeactivate(tH);
    (**tH).clikStuff = 255;            /*position caret on left*/
    TESetSelect(eolcharpos, eolcharpos, tH);    /*ambiguous point*/

If you want to ensure that the caret is on the right side (to which it normally defaults) then substitute a zero for the 255.

Back to top

References

Inside Macintosh, Volume V, Compatibility Guidelines

M.OV.GestaltSysenvirons

Back to top

Downloadables

Acrobat gif

Acrobat version of this Note (40K).

Download



Developer Documentation | Technical Q&As | Development Kits | Sample Code